#!/usr/bin/env/ python
# -*- coding: utf-8 -*-


import time
from datetime import datetime, timedelta

# 获取当前时间  :return 2024-12-12 14:23:21.69657
now_time = lambda: datetime.now()

# 获取时间戳(秒） :return 1591090855
get_second_Timestamp = lambda: int(time.time())

# 获取时间戳(毫秒） :return 1591090855000
get_millisecond_Timestamp = lambda: int(round(time.time() * 1000))

# 获取当年:return 2020
get_year = lambda: datetime.strftime(now_time(), "%Y")

# 获取当月 :return 08
get_month = lambda: datetime.strftime(now_time(), "%m")

# 获取当日 :return 03
get_day = lambda: datetime.strftime(now_time(), "%d")

# 获取当前日期  :return 2024_12_12
get_CurrentDate = lambda: datetime.strftime(now_time(), "%Y-%m-%d")

# 获取当前时间  :return 2024_12_12 17_40_55
get_CurrentTime = lambda: datetime.strftime(now_time(), '%Y-%m-%d %H-%M-%S')

# 获取其他日期  :return (2024, 31, 2) -> 现在是2024年，第31周，周2
get_OtherTimes = lambda: now_time().isocalendar()

# 获取之前时间戳(秒)  :param days: 天数  :return: 1591090855
get_previous_second_Timestamp = lambda days: int(time.mktime((now_time() - timedelta(days=days)).timetuple()))

# 获取之前时间戳(毫秒)  :param days: 天数  :return: 1591090855000
get_previous_millisecond_Timestamp = lambda days: int(
    time.mktime((now_time() - timedelta(days=days)).timetuple())) * 1000

# 获取之前日期  :param days: 天数  :return: 2024_12_12
get_previousDate = lambda days: (now_time() - timedelta(days=days)).strftime("%Y-%m-%d")

# 获取之前时间  :param days: 天数  :return: 2024_12_12 17_40_55
get_previousTime = lambda days: (now_time() - timedelta(days=days)).strftime("%Y-%m-%d %H-%M-%S")


if __name__ == '__main__':
    print(get_previousDate(365))